package com.funwell.modules.service.user;

import com.funwell.server.base.BaseService;
import com.funwell.server.constants.Errors;
import com.funwell.modules.controller.request.user.UserLoginRequestBean;
import com.funwell.modules.dao.user.UserMapper;
import com.funwell.modules.model.user.User;
import com.funwell.server.utils.ExceptionUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

/**
 * 用户功能service
 * @author sunfangwei
 *
 */
@Service
public class UserService extends BaseService<User,UserMapper> {
	

	
	public User login(UserLoginRequestBean bean) {
		User user=new User();
		BeanUtils.copyProperties(bean, user);
		user=dao.selectOne(user);
		if(user==null) {
			ExceptionUtil.throwException(Errors.USER_LOGIN_ERROR);
		}
		return user;
	}
	

}
